package com.guli.mall.wms.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.guli.mall.wms.service.WareOrderTaskDetailService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guli.common.utils.PageUtils;
import com.guli.common.utils.Query;

import com.guli.mall.wms.mapper.WareOrderTaskMapper;
import com.guli.mall.wms.entity.WareOrderTaskEntity;
import com.guli.mall.wms.service.WareOrderTaskService;

import javax.annotation.Resource;


@Service("wareOrderTaskService")
public class WareOrderTaskServiceImpl extends ServiceImpl<WareOrderTaskMapper, WareOrderTaskEntity> implements WareOrderTaskService {

    @Resource
    WareOrderTaskDetailService wareOrderTaskDetailService;


    @Override
    public PageUtils<WareOrderTaskEntity> queryPage(Integer currentPage, Integer size) {

        Page<WareOrderTaskEntity> page = new Page<>(currentPage, size);

        Page<WareOrderTaskEntity> resultPage = this.page(page);


        return new PageUtils<>(resultPage);
    }

    @Override
    public WareOrderTaskEntity getWareOrderTaskByOrderId(Long orderId) {

        QueryWrapper<WareOrderTaskEntity> wrapper = new QueryWrapper<>();

        wrapper.eq("order_id", orderId);

        return this.getOne(wrapper);
    }


    @Override
    public WareOrderTaskEntity getWareOrderTaskByOrderSn(String orderSn) {

        QueryWrapper<WareOrderTaskEntity> wrapper = new QueryWrapper<>();

        wrapper.eq("order_sn", orderSn);

        return this.getOne(wrapper);
    }

    @Override
    public List<Long> getWareOrderTaskDetailIdByOrderSn(String orderSn) {

        return this.getBaseMapper().getWareOrderTaskDetailIdByOrderSn(orderSn);

    }


}